#include <stdio.h>
#include <stdlib.h>
#include <time.h>

struct tree{
	struct tree* left;
	struct tree* right;
	int number;
};

void printTree(struct tree * t){
	printf("%d\t\n",t->number);
	if(t->left!=NULL){
		printf("l");
		printTree(t->left);
	}
	if(t->right!=NULL){
		printf("r");		
		printTree(t->right);
	}
}

int main(){
	struct tree root;
	root.number=1;
	int i=0;
	time_t tt=time(NULL);
	struct tree* parent=&root;
	struct tree* left,*right;
	for(;i<20;i++){
		left=(struct tree*)malloc(sizeof(struct tree));
		left->number=rand();
		right=(struct tree*)malloc(sizeof(struct tree));
		right->number=rand();
		parent->left=left;
		parent->right=right;
		if(rand()%2==0)
			parent=left;
		else
			parent=right;
	}
	
	printTree(&root);
	
	printf("\n");
	return 0;
}
